Close Language Gaps for Commands + Dialogs/Elicitations#960
Close Language Gaps for Commands + Dialogs/Elicitations#960MRayermannMSFT wants to merge 17 commits intomainfrom
Conversation
✅ Cross-SDK Consistency Review CompleteI've reviewed this PR for consistency across all four SDK implementations (Node.js, Python, Go, .NET). 🎯 Overall Assessment: Exemplary ConsistencyThis PR successfully adds Commands and UI Elicitation features to all four SDKs with excellent cross-language consistency while appropriately adapting to each language's idioms. Commands Feature ✅All four SDKs provide:
UI Elicitation Feature ✅All four SDKs provide the same four UI methods:
Handler registration is consistent:
Language-appropriate async patterns:
Documentation & Tests ✅✅ Documentation: All four README files include complete sections on Commands and UI Elicitation with code examples 🏆 ConclusionNo consistency issues found. This PR maintains excellent feature parity across all four SDKs and demonstrates the gold standard for cross-language SDK development. All language-specific variations are appropriate adaptations to each ecosystem's conventions. Great work! 🚀
|
- Python: fix ruff formatting, add comments to empty except blocks, remove unused imports - .NET: simplify boolean expressions, combine nested ifs, narrow generic catch clause - Go: fix struct field alignment for go fmt compliance
Cross-SDK Consistency Review: Commands & UI Elicitation ✅This PR successfully closes the language gaps for Commands and UI Elicitation features across Python, Go, and .NET SDKs. The implementations maintain excellent consistency with the Node.js SDK reference implementation. ✅ Consistent API SurfaceAll four SDKs now expose parallel APIs with appropriate language conventions:
The naming differences (camelCase vs PascalCase, ✅ Consistent BehaviorAll SDKs implement:
|
✅ Cross-SDK Consistency ReviewI've reviewed this PR for consistency across all four SDK implementations (Node.js, Python, Go, and .NET). SummaryThis PR successfully adds Commands and UI Elicitation features to Go, .NET, and Python SDKs to achieve feature parity with the Node.js SDK. The implementation is excellent — all APIs are semantically consistent while following their respective language conventions. What This PR Adds
API Consistency VerificationCommand DefinitionsAll SDKs now expose
UI Elicitation MethodsAll SDKs provide the same four methods with appropriate language naming:
Return types follow language idioms:
Capabilities Access
Test CoverageThe PR includes comprehensive test coverage:
ConclusionNo consistency issues found. This PR maintains excellent cross-SDK consistency while respecting language-specific conventions. All four SDKs now have feature parity for Commands and UI Elicitation. 🎉
|
…apabilities.changed reliably in replay proxy
✅ Cross-SDK Consistency Review: PR #960I've completed a comprehensive review of this PR to ensure consistency across all four SDK implementations (Node.js, Python, Go, and .NET). SummaryOverall Assessment: Excellent consistency 🎉 This PR successfully brings Python, Go, and .NET up to feature parity with the existing Node.js SDK for Commands and UI Elicitation APIs. The implementations are highly consistent across all languages, with appropriate adaptations for language-specific idioms. Features Added1. Commands API ✅All three SDKs now support slash commands with consistent structure:
2. UI Elicitation API ✅All three SDKs provide four UI methods:
All methods:
Language-Specific Adaptations (All Appropriate ✅)The implementations correctly adapt to each language's conventions:
Note on Go's Testing Coverage ✅Comprehensive test coverage added for all three SDKs: Python:
Go:
.NET:
Shared test snapshots added for replay proxy:
Documentation ✅All README files updated with:
Verified Consistency Points ✅
No Issues FoundI found no cross-SDK inconsistencies that need to be addressed. The PR maintains excellent feature parity while respecting language-specific conventions. Recommendation✅ Approve from a cross-SDK consistency perspective This PR exemplifies how to properly implement cross-language SDKs: consistent APIs that feel natural in each language.
|
…connect Python's socket.makefile() holds its own reference to the socket. Calling socket.close() alone won't release the OS-level resource until the makefile wrapper is also closed. This meant force_stop() wasn't actually closing the TCP connection, so the server never detected the disconnect and never sent capabilities.changed events to other clients. Fix: close the file wrapper before the socket in SocketWrapper.terminate(). Unskip test_capabilities_changed_when_elicitation_provider_disconnects.
- Narrow generic catch clauses in .NET command/elicitation handlers with 'when (ex is not OperationCanceledException)' filter - Remove redundant null-conditional (val?.ToString -> val.ToString) in SelectAsync and InputAsync switch expressions - Add explanatory comments to Python empty except blocks
✅ Cross-SDK Consistency ReviewI've reviewed PR #960 for consistency across all four SDK implementations (Node.js, Python, Go, and .NET). This PR successfully adds Commands and UI Elicitation features to Python, Go, and .NET, bringing them to feature parity with the Node.js SDK. Summary of ChangesCommands Feature:
UI Elicitation Feature:
API Consistency Across LanguagesThe implementations properly account for language-specific conventions:
|
…nect socket.close() and file wrapper close don't reliably interrupt a blocking readline() on another thread in Python. socket.shutdown(SHUT_RDWR) sends TCP FIN to the server immediately (triggering server-side disconnect detection) and interrupts any pending blocking reads across threads — matching Node.js socket.destroy() and Go conn.Close() behavior.
✅ Cross-SDK Consistency Review: APPROVEDI've completed a comprehensive cross-language consistency review of PR #960. This PR successfully closes the feature gaps for Commands and UI Elicitation across Python, Go, and .NET SDKs, bringing them to parity with the Node.js SDK. SummaryScope: Adds three feature gaps to Python, Go, and .NET:
Node.js SDK: Not modified (already has these features) ✅ Consistency Findings1. Commands API — Highly ParallelAll SDKs expose consistent command APIs with language-appropriate naming:
✅ All use the same underlying RPC wire protocol and event routing patterns. 2. UI Elicitation API — Highly ParallelAll SDKs expose identical convenience methods with language-appropriate naming:
✅ Capability checking is consistent:
3. onElicitationRequest Handler — ConsistentAll SDKs allow registering a handler via
All send 4. Test Coverage — Comprehensive✅ All three target SDKs have:
✅ Shared snapshots ensure identical wire protocol behavior across all languages. 5. Documentation — Complete✅ All three target SDK READMEs updated with:
Verdict🎉 No consistency issues found. This PR achieves excellent feature parity across all four SDK implementations. The APIs follow language-specific conventions (snake_case vs PascalCase, async/await patterns) while maintaining semantic consistency. The team successfully applied the principle: same feature, same behavior, language-appropriate naming.
|
✅ Cross-SDK Consistency Review: APPROVEDI've completed a thorough cross-language consistency review of PR #960, comparing the Commands and UI Elicitation implementations across all four SDKs (.NET, Go, Python, and the reference Node.js implementation). 🎯 SummaryExcellent work! This PR successfully achieves feature parity across all SDK implementations. The APIs are semantically equivalent, follow language-specific naming conventions appropriately, and maintain consistent behavior patterns. ✅ Commands API — Fully ConsistentAll four SDKs provide equivalent Commands functionality:
✅ UI Elicitation API — Fully ConsistentAll four SDKs expose the same UI methods:
Capability checking: All SDKs properly gate UI methods with 📚 Documentation — Comprehensive & ConsistentAll three SDK READMEs (dotnet, go, python) have been updated with:
🧪 Test Coverage — CompleteTest files added/modified:
📝 Minor Observations (Not blocking)
🎉 ConclusionThis PR successfully closes the language gaps and brings feature parity to all four SDK implementations. The implementations are:
No consistency issues found. Great work on maintaining parallel implementations! 🚀
|
There was a problem hiding this comment.
Pull request overview
This PR closes feature parity gaps across the SDKs by adding slash commands and UI elicitation dialogs / elicitation callbacks, including capability reporting and multi-client broadcast behavior (capabilities/commands changed) with corresponding docs and tests.
Changes:
- Adds command registration +
command.executedispatch/response handling across Python, Go, and .NET. - Adds UI elicitation APIs (confirm/select/input/custom schema),
onElicitationRequestcallback handling, andcapabilitiesplumbing (create/resume response +capabilities.changed). - Adds/updates E2E + unit tests and replay snapshots to cover single- and multi-client scenarios.
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/snapshots/multi_client/client_receives_commands_changed_when_another_client_joins_with_commands.yaml | New replay snapshot for multi-client commands broadcast scenario |
| test/snapshots/multi_client/capabilities_changed_fires_when_second_client_joins_with_elicitation_handler.yaml | New replay snapshot for multi-client capabilities enablement scenario |
| test/snapshots/multi_client/capabilities_changed_fires_when_elicitation_provider_disconnects.yaml | New replay snapshot for multi-client capabilities disablement scenario |
| test/snapshots/elicitation/session_without_elicitationhandler_reports_no_capability.yaml | New replay snapshot for elicitation capability baseline |
| test/snapshots/elicitation/session_without_elicitationhandler_creates_successfully.yaml | New replay snapshot for session creation without elicitation handler |
| test/snapshots/elicitation/session_without_elicitation_handler_reports_no_capability.yaml | New replay snapshot variant for elicitation capability baseline |
| test/snapshots/elicitation/session_with_elicitationhandler_reports_elicitation_capability.yaml | New replay snapshot for elicitation capability when handler is present |
| test/snapshots/elicitation/session_with_elicitation_handler_reports_elicitation_capability.yaml | New replay snapshot variant for elicitation capability when handler is present |
| test/snapshots/elicitation/sends_requestelicitation_when_handler_provided.yaml | New replay snapshot for requestElicitation flag behavior |
| test/snapshots/elicitation/elicitation_throws_when_capability_is_missing.yaml | New replay snapshot for capability-gated UI API behavior |
| test/snapshots/elicitation/defaults_capabilities_when_not_provided.yaml | New replay snapshot for default capabilities behavior |
| test/snapshots/commands/session_with_no_commands_creates_successfully.yaml | New replay snapshot for session creation with no commands |
| test/snapshots/commands/forwards_commands_in_session_resume.yaml | New replay snapshot for resume payload forwarding commands |
| test/snapshots/commands/forwards_commands_in_session_create.yaml | New replay snapshot for create payload forwarding commands |
| python/test_commands_and_elicitation.py | New Python unit coverage for commands, elicitation APIs/callbacks, and capabilities.changed |
| python/README.md | Documents Python commands + UI elicitation + elicitation request handler semantics |
| python/e2e/test_ui_elicitation.py | Python E2E tests for capability gating + capability reporting with handler |
| python/e2e/test_ui_elicitation_multi_client.py | Python E2E multi-client tests for capabilities.changed enable/disable behavior |
| python/e2e/test_commands.py | Python E2E multi-client test for commands.changed broadcast |
| python/copilot/session.py | Implements Python command routing, UI elicitation API, elicitation callback handling, and capabilities updates |
| python/copilot/client.py | Wires commands + requestElicitation flags into create/resume payloads; stores capabilities from responses; improves TCP socket termination |
| python/copilot/init.py | Exposes newly added Python public types (commands/elicitation/capabilities/UI API) |
| go/types.go | Adds Go commands/elicitation/capabilities types and a new Int() pointer helper |
| go/session.go | Implements Go command routing, UI elicitation API, elicitation callback handling, and capabilities storage |
| go/session_test.go | Adds Go unit tests for command routing + capabilities + elicitation gating/handler storage |
| go/client.go | Serializes commands + requestElicitation and registers handlers; stores capabilities from responses |
| go/client_test.go | Adds Go request/response serialization tests for commands + requestElicitation + capabilities |
| go/README.md | Documents Go commands + UI elicitation + elicitation request handling |
| go/internal/e2e/commands_and_elicitation_test.go | Adds Go E2E coverage for commands + elicitation + multi-client capabilities changes |
| dotnet/test/MultiClientCommandsElicitationTests.cs | Adds .NET E2E multi-client tests for commands.changed and capabilities.changed enable/disable |
| dotnet/test/ElicitationTests.cs | Adds .NET E2E + type-structure tests for elicitation + capabilities gating |
| dotnet/test/CommandsTests.cs | Adds .NET E2E + type-structure tests for commands + config cloning |
| dotnet/src/Types.cs | Adds .NET public types for commands, elicitation, UI API, and capabilities; extends config cloning |
| dotnet/src/Session.cs | Implements .NET command routing, elicitation callback handling, UI API, and capabilities updates |
| dotnet/src/Client.cs | Adds commands + requestElicitation to wire requests; stores capabilities from responses; adds JSON source-gen types |
| dotnet/README.md | Documents .NET commands + UI elicitation + elicitation request handler behavior |
Go was only passing RequestedSchema.Properties to the elicitation handler, dropping the 'type' and 'required' fields. This meant handlers couldn't reconstruct the full JSON Schema. Now passes a complete map with type, properties, and required. Also replaces custom containsString/searchSubstring helpers in Go tests with strings.Contains, and adds tests in Go and Python that verify the full schema is passed through to elicitation handlers.
Use direct schema extraction logic test instead of dispatching through session event machinery, avoiding need for RPC mocks. Fixes undefined SessionEventData and handleEvent references.
✅ Cross-SDK Consistency Review: PASSEDThis PR successfully brings Commands and UI Elicitation features to Python, Go, and .NET, achieving feature parity with the existing Node.js SDK implementation. Consistency Analysis✅ API Structure: All four SDKs now have identical feature sets:
✅ Naming Conventions: Proper language idioms are followed:
✅ Behavioral Consistency:
VerificationI verified consistency by comparing:
No consistency issues found. This PR successfully closes the language gaps for Commands and UI Elicitation features. 🎉
|
…tests - Command handler error propagation: verifies handler error is returned - Unknown command: verifies getCommandHandler returns false for unknown - Elicitation handler error: verifies error propagation from handler - Elicitation handler success: verifies result with action and content
✅ Cross-SDK Consistency Review: Commands + UI ElicitationI've reviewed this PR for consistency across all four SDK implementations. Overall, this PR does an excellent job closing the language gaps and maintaining API parity! 🎉 Summary of ChangesThis PR adds Commands and UI Elicitation features to:
These features already existed in the Node.js SDK, so this PR brings all SDKs to feature parity. API Consistency Analysis✅ Commands API - Excellent ConsistencyAll SDKs implement the same core API pattern:
Minor architectural difference (acceptable):
This is a reasonable design choice—Node.js's approach allows dynamic command registration, while the others use configuration-time registration. ✅ UI Elicitation API - Excellent ConsistencyAll SDKs expose the same 4 UI methods with equivalent signatures:
Capability checking: All SDKs properly gate UI methods behind Language idioms respected:
📚 Documentation Gap FoundIssue: The .NET README is missing a dedicated Commands section with code examples. Current state:
Recommendation: Add a dedicated "Commands" section to ### Commands
Register slash commands that users can invoke via `/commandName` in the CLI TUI:
```csharp
var session = await client.CreateSessionAsync(new SessionConfig
{
Commands = new List(CommandDefinition)
{
new()
{
Name = "deploy",
Description = "Deploy the application",
Handler = async (context, ct) =>
{
Console.WriteLine($"Deploying to {context.Args}...");
// Your deployment logic here
}
}
}
});
```
The handler receives a `CommandContext` with:
- `SessionId`: Current session identifier
- `CommandName`: Command name (without `/`)
- `Args`: Raw argument string✅ Test Coverage - CompleteAll SDKs now have comprehensive test coverage:
ConclusionThis PR successfully achieves cross-SDK consistency! The only improvement needed is enhancing the .NET documentation to match the clarity of other SDKs. The API implementations are solid and maintain appropriate language idioms while ensuring semantic equivalence. Suggested next step: Add the Commands documentation section to
|
…ET README Matches Go and Python README structure where these are ## (h2) sections rather than ### (h3) subsections. Closes documentation gap flagged by SDK Consistency Review Agent.
✅ Cross-SDK Consistency Review: APPROVEDI've completed a thorough review of PR #960 for cross-language SDK consistency. This PR adds Commands and UI Elicitation features to the Go, Python, and .NET SDKs, bringing them to feature parity with the Node.js/TypeScript SDK which already has these capabilities. Summary of ChangesThe PR adds two major features across three SDKs: 1. Commands API (Slash Commands)
2. UI Elicitation API (Interactive Dialogs)
✅ Consistency AnalysisAPI Surface Parity:
Documentation Consistency:
Test Coverage:
Wire Protocol:
🎯 Key Observations
🏁 ConclusionThis PR successfully closes the feature gap between SDKs. All four language implementations now have:
No consistency issues found. The implementation maintains excellent cross-SDK parity while respecting each language's idiomatic patterns.
|
What
Adds Commands and UI Elicitation support to the Python, Go, and .NET SDKs, closing the feature gap with the Node.js reference implementation. Each SDK now supports registering slash commands, handling elicitation requests from the server, and driving interactive form dialogs (confirm, select, input) through a capability-gated UI API — with full documentation, unit tests, and E2E tests matching the Node.js test surface.
Why
These two features were recently shipped in the Node.js SDK only, leaving the other three languages unable to participate in command dispatch or elicitation flows. Any multi-language deployment that relied on commands or form-based user input would have been forced to use the Node.js SDK exclusively. Closing this gap ensures all four SDKs offer the same capabilities, preventing fragmentation and letting teams choose the language that fits their stack.